<?php

namespace App\Admin\Controllers;

use App\Models\Screen;
use Encore\Admin\Form;
use Encore\Admin\Grid;
use Encore\Admin\Show;
use Encore\Admin\Controllers\AdminController;

class ScreensController extends AdminController
{
    protected $title = '筛选条件';
    
    protected function grid()
    {
        $grid = new Grid(new Screen());
	
	    $grid->disableExport();
	    
	    $grid->column('title', '标题');
	    $grid->column('order', '排序')->editable();
        $grid->column('is_home_search', '是否首页筛选条件')->bool();
        return $grid;
    }
    
    protected function detail($id)
    {
        $show = new Show(Screen::findOrFail($id));



        return $show;
    }
    
    protected function form()
    {
        $form = new Form(new Screen());
	    $form->text('title', '标题');
	    $form->select('type', '类型')->options(config('site.types'));
	    $form->number('order', '排序')->min(1)->default(1);
        $form->radio('is_home_search', '首页筛选条件')->options(config('site.bool'))->default(false);
	   

        return $form;
    }

}
